'''
变量的学习。
1.变量类型
2.变量比较
3.变量的引用
'''


# 变量类型
def type1():
    # 变量赋值，使用=
    var1 = 3
    var2 = "晓梦"
    var3 = 12.45
    var4 = True
    var42 = False
    var5 = None

    str = '''
    123
    456
    '''

    t1 = type(var1)
    print(t1)  # 调用方法的语法  方法名()
    print(type(var2))
    print(type(var3))
    print(type(var4))
    print(type(var5))


# 变量比较
def equal():
    var1 = 3
    var2 = '3'
    print(var1 == var2)
    rs = var1 != var2
    if rs:
        print('有名字的if分支')


# 变量的引用
def swap():
    a = 'ABC'
    b = 'XYZ'
    b = a
    a = 'XYZ'
    print(a)
    print(b)
    var1 = 1
    var1 + 1
    print(var1)
    var1 = var1 + 1
    print(var1)


# 变量类型的作用
def oper():
    var1 = 2
    var2 = 3
    var3 = '2'
    var4 = "3"
    var5 = 'abcd'
    # 数字支持的运算
    print(var1 + var2)
    print(var1 - var2)
    print(var1 * var2)
    print(var1 / var2)
    print(var1 // var2)  # //得到整数商
    print(var1 % var2)  # %得到余数

    print(var3 + var4)
    print(var5.find('ef'))

    var1 = True
    var2 = False
    print(var1 and True and False)
    print(False or var2)
    print(not var1)
    print(not var2)


# 格式化输出
def printf():
    var1 = "张晓梦"
    print(f"你好呀，{var1}")


# type1()
# equal()
swap()
# oper()
# printf()
